package com.servlet01; /**
 * @author wzm
 * @create 2023-09-19 11:46
 * project_name:javaweb2308
 */

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
//当路径匹配时执行Servlet
//@WebServlet("/demo4")

//配个多个urlPattern 表示只要是配置的地址都会访问
//@WebServlet(urlPatterns = {"/servlet001","/servlet002"})

//多级路径精确匹配
//@WebServlet("/emp/list")

//目录匹配
//@WebServlet(urlPatterns = "/emp/*")

//扩展名匹配
//@WebServlet("*.do")

/*任意匹配*/
//@WebServlet("/*")
public class Servlet02 extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //当请求时get时执行
        System.out.println("get执行了");
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //当请求时post时执行
        System.out.println("post执行了");
    }
}
